<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户主页</title>
    <style>
        /* 全局样式 */
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: 'Segoe UI', 'PingFang SC', 'Microsoft Yahei', sans-serif;
            background: linear-gradient(135deg, #e0f7fa, #f3e5f5);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 40px 20px;
            color: #333;
        }

        .card {
            background: white;
            width: 100%;
            max-width: 400px;
            padding: 30px 25px;
            border-radius: 16px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
            transition: all 0.3s ease;
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
        }

        h2 {
            text-align: center;
            margin-bottom: 24px;
            font-weight: 600;
            color: #374151;
        }

        .actions {
            display: flex;
            flex-direction: column;   /* 纵向排列按钮 */
            align-items: center;     /* 居中显示按钮 */
            gap: 15px;              /* 按钮间距 */
        }

        .btn {
            width: 100%;            /* 自适应容器宽度 */
            padding: 12px 20px;
            background-color: #d1ecf1;
            color: #15576b;
            border-radius: 8px;
            text-decoration: none;
            font-weight: 500;
            transition: background 0.3s, color 0.3s;
            text-align: center;
            box-sizing: border-box;
        }

        .btn:hover {
            background-color: #aee2eb;
            color: #0f3d4d;
        }
    </style>
</head>
<body>

<% if (session.getAttribute("user") != null) { %>
<div class="card">
    <h2>👋 欢迎回来, ${sessionScope.user.username}！</h2>
    <div class="actions">
        <a href="user_massage.jsp" class="btn">进入个人主页</a>
        <a href="my_class.jsp" class="btn">我的课程</a>
        <a href="LogoutServlet" class="btn">安全退出账号</a>
    </div>
</div>
<% } else { %>
<div class="card">
    <h2>您尚未登录，请先登录</h2>
    <div class="actions">
        <a href="login.jsp" class="btn">立即登录</a>
    </div>
</div>
<% } %>

</body>
</html>
